<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算任意数字的和、差、积、商</title>
</head>
<body>
    <script>
        function toCalculate(){

            var n = arguments.length;
            //加、减、乘、除初始化
            var jia = 0;
            var jian = 0;
            var cheng = 1;
            var chu = 1;
            for(var i=0;i<n;i++){
                console.log('参与计算的值：' + arguments[i]);
                jia += arguments[i];
                jian -= arguments[i];
                cheng *= arguments[i];
                chu /= arguments[i];
            }
            document.write('输入的值的加、减、乘、除依次为：'+jia +',' + jian +',' + cheng +',' + chu);

        }

        toCalculate(1,2,3,4,5);
    </script>
</body>
</html>